#pragma once

#include <iostream>
#include <istream>
#include <cstdlib>
#include <cassert>

// I_SIZED_ARRAY prototypes
template<class R, class A>
I_ARRAY<R> map(R (*func)(A), I_ARRAY<A>);

// I_ARRAY prototypes
template<class T> I_ARRAY<T> load_array(C_STR);
template<class T> void free_array(I_ARRAY<T>);

// position board prototypes
void load_position_boards(I_POSITION_BOARDS*, C_STR);
void load_position_boards(I_POSITION_BOARDS*, std::istream&);

// array search algorithms
template<class T> int binary_search(I_ARRAY<T>, T);
template<class T> int binary_search(T*, int, T);
template<class T> int linear_search(I_ARRAY<T>, T);
template<class T> int linear_search(T*, int, T);

// work with Forsyth-Edwards notation
I_CHESS_POSITION* read_FEN(C_STR);
C_STR write_FEN(I_CHESS_POSITION*);

// helper functions
inline int get_index(C_STR);
inline int rank(char);
inline int file(char);

// print functions for use in move_to_str
inline void write_coord(int, C_STR);
inline void write_rank(int, C_STR);
inline void write_file(int, C_STR);
